#pragma once

#include <string>
#include <CL/cl.h>

using namespace std;

class ComOpenCL{
private:
	cl_int status;
	cl_device_id * devices;
	cl_platform_id platform;
	
	cl_command_queue commandQueue;
	cl_program program;
	cl_kernel kernel;
	void getSource(string kernelfile, string &source);
	void disPlayError(cl_int error_code);
public:
	cl_context context;
	ComOpenCL(cl_int type, string kernelfile, string kernelname);
	~ComOpenCL();
	void execTask(cl_uint dimension, size_t *globalsize, size_t *localsize, cl_event * event);
	void collectResult(cl_mem buffer, size_t size, void * value_ptr);
	void setKernelArg(cl_int index,size_t argsize,const void *arg);
};